<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>享送小哥</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
</head>

<body>
    <header class="aui-bar aui-bar-nav aui-bar-light u-aui-bar" id="header">
        <a href="javascript:api.closeWin();" class="aui-pull-left aui-btn"> <span class="aui-iconfont aui-icon-left"></span> </a>
        <div class="aui-title u-aui-title">{{title}}</div>
        <div class="aui-pull-right" style="color: #333!important;" v-if="title!='官方公告'" @click="clear">清空</div>
    </header>

    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/vue.js"></script>
    <script type="text/javascript" src="../script/app.js"></script>
    <script type="text/javascript">
        apiready = function() {
            var statusBarPos = app.statusBar.pos();
            var headerPos = app.pos("header");

            api.openFrame({
                name: 'message_list_content',
                url: 'message_list_content.html',
                rect: {
                    x: 0,
                    y: statusBarPos.h + headerPos.h,
                    w: 'auto',
                    h: 'auto'
                },
                bounces: true,
                pageParam: api.pageParam
            });

            vObj = new Vue({
                el: "#header",
                data: {
                    title: api.pageParam.title,
                },
                methods: {
                    clear: function() {
                        var type = 0;
                        switch (api.pageParam.act) {
                            case 'system':
                                type = 2;
                                break;
                            case 'order':
                                type = 3;
                                break;
                        }
                        if (type > 0) {
                            app.request.post('Client/clearMessage', {
                                type: type
                            }, {}, function(res) {
                                if (res.code == 200) {
                                    api.execScript({
                                        frameName: 'message_list_content',
                                        script: 'vObj.getList()'
                                    });
                                } else {
                                    app.error(res.message);
                                }
                            });
                        }
                    }
                }
            });
        }
    </script>
</body>

</html>
